import request from '@/utils/http'

/*
params: {
  orderState:0,
  page:1,
  pageSize:2
}
*/

//获取所有订单
export const getUserOrder = () => {
  return request({
    url: '/user/order/list',
    method: 'GET'
  })
}

// 获取单个订单详情接口
export const getCheckListAPI = (orderId) => {
  return request.get('/user/order/detail',{ params: { orderId } })
}

//获取已完成的订单
export const getFinishOrder = () => {
  return request({
    url: '/user/order/alreadyPay',
    method: 'GET',
  })
}

//获取待付款的订单
export const getUnpaidOrder = () => {
  return request({
    url: '/user/order/needPay',
    method: 'GET',
  })
}

//发送评论
export const sendComment = (productId,data) => {
  setTimeout(()=>{
    console.log(productId)
  })
  return request({
    url: `/product/comment?productId=${productId}`,
    method: 'POST',
    data
  })
}

//删除订单
export const deleteOrder = (orderId) => {
  return request.delete('/user/order/detail',{ params: { orderId } })
}